package com.ruben.simplegraphql.convert.mapper;

import com.ruben.simplegraphql.pojo.po.UserInfo;
import com.ruben.simplegraphql.pojo.vo.UserVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.springframework.core.convert.converter.Converter;

/**
 * UserPoToVoMapper
 *
 * @author VampireAchao
 * @since 2022/9/25
 */
@Mapper(componentModel = "spring")
public interface UserPoToVoMapper extends Converter<UserInfo, UserVO> {

    /**
     * Convert the source object of type {@code S} to target type {@code T}.
     *
     * @param source the source object to convert, which must be an instance of {@code S} (never {@code null})
     * @return the converted object, which must be an instance of {@code T} (potentially {@code null})
     * @throws IllegalArgumentException if the source cannot be converted to the desired target type
     */
    @Override
    @Mapping(target = "roles", ignore = true)
    UserVO convert(UserInfo source);
}
